<?php
namespace Helper\Controller;

use Common\Controller\ApiController;

class StatisticalController extends ApiController
{
    public function unread()
    {
        $user = $this->user;
        $nWhere = [
            'user_id' => $user['id'],
            'is_read' => 'F',
        ];
        $nCount = D('Notification')->where($nWhere)->count();

        D('Account/MessageBox')->pickGlobalMessage($this->user['id']);
        $mWhere = [
            'user_id' => $user['id'],
            'is_read' => 0,
        ];
        $mCount = D('Account/MessageBox')->where($mWhere)->count();
        $payload = [
            'message' => $mCount,
            'notification' => $nCount,
        ];
        $this->response($payload);
    }

    
}
